@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;

    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;

    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;

    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;

    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;

    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;

    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
}

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 3.9%;
    --primary: 0 0% 9%;
    --primary-foreground: 0 0% 98%;
    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;
    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;
    --accent: 0 0% 96.1%;
    --accent-foreground: 0 0% 9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 89.8%;
    --input: 0 0% 89.8%;
    --ring: 0 0% 3.9%;
    --chart-1: 12 76% 61%;
    --chart-2: 173 58% 39%;
    --chart-3: 197 37% 24%;
    --chart-4: 43 74% 66%;
    --chart-5: 27 87% 67%;
    --radius: 0.5rem;
  }
  .dark {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 0 0% 9%;
    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --accent: 0 0% 14.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --ring: 0 0% 83.1%;
    --chart-1: 220 70% 50%;
    --chart-2: 160 60% 45%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
  }
}

body {
  height: 100vh;
}

.step-run-card {
  --transition: 0.25s;
  --spark: 3s;
  display: grid;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1000px 0 0 hsl(217.2 32.6% 17.5%) inset;
  transition: box-shadow var(--transition), background var(--transition),
    transform var(--transition);
}

.step-run-card.active .step-run-backdrop {
  background: 222.2 84% 4.9%;
}

.step-run-card.active {
  transform: scale(1.05);
}

.spark {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  rotate: 0deg;
  overflow: hidden;
  mask: linear-gradient(white, transparent 50%);
  animation: flip calc(var(--spark) * 2) infinite steps(2, end);
}

@keyframes flip {
  to {
    rotate: 360deg;
  }
}

.spark:before {
  content: "";
  position: absolute;
  width: 200%;
  aspect-ratio: 1;
  inset: 0 auto auto 50%;
  z-index: -1;
  translate: -50% -15%;
  rotate: 0;
  transform: rotate(-90deg);
  opacity: 1;
  background: conic-gradient(from 0deg, transparent 0 340deg, white 360deg);
  transition: opacity var(--transition);
  animation: rotate var(--spark) linear infinite both;
}

.step-run-backdrop {
  position: absolute;
  inset: 1px;
  background: 222.2 84% 4.9%;
  border-radius: 10px;
  transition: background var(--transition) opacity var(--transition);
}

@keyframes rotate {
  to {
    transform: rotate(90deg);
  }
}

.text {
  z-index: 1;
  color: rgb(203 213 225);
}

/* Code block styles */
html.dark .nextra-code-block pre {
  background-color: #1e293b !important;
}

/* Base dark mode styles */
html.dark main {
  background-color: #020817;
}

html.dark body {
  background-color: var(--background) !important;
}

/* Fix for Nextra 3 theme-switcher and sidebar footer */
html.dark .nx-fixed,
html.dark ._fixed,
html.dark .dark\:nx-bg-dark,
html.dark .dark\:_bg-dark,
html.dark .nx-bg-white,
html.dark ._bg-white {
  background-color: #020817 !important;
}

/* Fix for system preferences button in theme switcher */
html.dark .nx-text-gray-800,
html.dark ._text-gray-800 {
  color: #f8fafc !important;
}

/* Fix for theme switcher borders */
html.dark .nx-border-gray-200,
html.dark ._border-gray-200,
html.dark .nx-border,
html.dark ._border {
  border-color: #1e293b !important;
}

/* Bottom nav container */
html.dark div.nx-sticky.nx-bottom-0,
html.dark div._sticky._bottom-0 {
  background-color: #020817 !important;
}

html.dark div.nextra-nav-container {
  background-color: #020817 !important;
}

.nextra-nav-container-blur {
  background-color: var(--background) !important;
}

nav {
  background-color: var(--background) !important;
}

.dark .nx-sticky,
.dark ._sticky {
  box-shadow: none !important;
}

/* Center numbers in steps */
.nextra-steps h3::before {
    line-height: 25px;
}

/* Breadcrumb link styles in dark mode */
.dark .nextra-breadcrumb a,
.dark .nextra-breadcrumb a:visited,
.dark .nextra-breadcrumb a:hover,
.dark .nextra-breadcrumb a:active {
  background: none !important;
  -webkit-text-fill-color: var(--ash-gray) !important;
}

:is(html[class~="dark"]) .nextra-nav-container-blur.nx-pointer-events-none {
  background-color: var(--background) !important;
}

.shiki {
  padding: 15px !important;
  border-radius: 10px !important;
  background-color: rgba(40, 99, 159, 0.05) !important;
}

pre.shiki {
  overflow-x: auto;
}

.dark .shiki {
  background-color: #1e293b !important;
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}
